<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addUI.jsp' starting page</title>
    <link rel="stylesheet" href="<%=path %>/siteresource/css/global.css" type="text/css"/>
	<link rel="stylesheet" href="<%=path %>/siteresource/css/list.css" type="text/css"/>
	<link rel="stylesheet" href="<%=path %>/siteresource/css/menu.css" type="text/css"/>
	<script src="<%=path %>/siteresource/js/fixPNG.js" type="text/javascript"></script>
	<script type="text/javascript" src="<%=path %>/siteresource/js/jqueryui-1.8.min.js"></script>
<script type="text/javascript" src="<%=path %>/siteresource/js/manhuaDate.1.0.js"></script>
    <script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(function(){
        	$("#form1").submit(function(){
        		return checkName();
        	});
        });
        function checkName(){
        	var nameCn=$("#nameCn").val();
        	if(nameCn.length==0){
        		alert('xx');
        		return false;
        	}
        	return true;
        }
        
    </script>
  </head>
  
  <body>
  
 
<div class="infolist">
<s:if test="#emp==null">
 <s:form action="jsp/system/user/get.action" method="post" id="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0">

  <tr>
    <td colspan="6" class="title center" style="color:red">这里是添加员工页面 
    </td>
    </tr>
   <tr class="line_g">
    <td width="10%" class="jianju10">员工编号：</td>
    <td width="90%" class="jianju20"><input type="text" name="emp.sn"/></td>
  </tr>
  <tr class="line_g">
    <td width="10%" class="jianju10">员工姓名：</td>
    <td width="90%" class="jianju20"><input id="name" name="emp.name"></input></td>
  </tr>
  <tr class="line_g">
    <td class="jianju10">员工密码：</td>
    <td class="jianju20"><input id="password" name="emp.password"></input></td>
  </tr>
  <tr class="line_g">
  <td>所在部门：
     <select name="sid">
               <s:iterator value="#deptlist">
               			<option value="<s:property value="id"/>"><s:property value="name"/></option>               		
               </s:iterator>
               </select>
               </td>
    </tr>
    <tr class="line_g">
  <td>职位：
     <select name="selectid">
               <s:iterator value="#list2">
               			<option value="<s:property value="id"/>"><s:property value="name_cn"/></option>               		
               </s:iterator>
               </select>
               </td>
    </tr>
    <tr class="line_g">
    <td>状态：</td>
    <td class="jianju20"><input id="status" name="emp.status"></input></td>
    </tr>
     <tr>
     <td><input type="submit" value="提交"></td>
    </tr> 
    </table>
</s:form> 
  </s:if>
  
  
  
  
 <s:if test="#emp!=null">
<form action="jsp/system/user/get.action?oper=edit" method="post" id="form2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="6" class="title center" style="color:red">这里是修改员工页面 
    </td>
    </tr>
   <tr class="line_g">
    <td width="10%" class="jianju10">员工编号：
    <td width="90%" class="jianju20"><input type="text" name="emp.sn" value="<s:property value="#emp.sn"/>"/></td>
  </tr>
  <tr class="line_g">
    <td width="10%" class="jianju10">员工姓名：</td>
    <td width="90%" class="jianju20"><input type="text" name="emp.name" value="<s:property value="#emp.name"/>"/></td>
  </tr>
  <tr class="line_g">
    <td class="jianju10">员工密码：</td>
    <td class="jianju20"><input type="text" name="emp.password" value="<s:property value="#emp.password"/>"/></td>
  </tr>
  <tr class="line_g">
  <td>所在部门：
     <select name="sid">
               <s:iterator value="#deptlist">
               <s:if test="name==#emp.department.name">
               			<option selected="selected" value="<s:property value="id"/>"><s:property value="name"/></option>
               	</s:if>  
               	<s:if test="name!=#emp.department.name">
               			<option selected="selected" value="<s:property value="id"/>"><s:property value="name"/></option>
               	</s:if>           	         		
               </s:iterator>
               </select>
               </td>
    </tr>
    <tr class="line_g">
  <td>职位：
     <select name="selectid">
               <s:iterator value="#list2">
                        <s:if test="name_cn==#emp.position.name_cn">
               			<option selected="selected" value="<s:property value="id"/>"><s:property value="name_cn"/></option>
               			</s:if>  
               			 <s:if test="name_cn!=#emp.position.name_cn">
               			<option selected="selected" value="<s:property value="id"/>"><s:property value="name_cn"/></option>
               			</s:if>                     		
               </s:iterator>
               </select>
               </td>
    </tr>
    <tr class="line_g">
    <td>状态：</td>
    <td class="jianju20"><input type="text" name="emp.status" value="<s:property value="#emp.status"/>"/></td>
    </tr>
    <tr>
     <td><input type="submit" value="提交"></td>
    </tr> 
    </table>
</form> 
</s:if>
</div>
</body>
</html>
